package summary;

/**
 * @Author: 海琳琦
 * @Date: 2022/4/6 20:58
 */
public class Sword15 {

    public int hammingWeight(int n) {
        int count = 0;
        for (int i = 0; i < 32; i++) {
            if ((n & (1 << i)) != 0) {
                count++;
            }
        }
        return count;
    }

    public static void main(String[] args) {

    }
}
